package com.pet.server.ext.action.article;

import net.sf.json.JSONArray;

import com.pet.server.ext.ActionBase;
import com.pet.server.ext.ApiError;
import com.pet.server.ext.Result;
import com.pet.server.ext.data.Article;
import com.pet.server.ext.data.Page;
import com.pet.server.ext.data.UserArticle;
import com.pet.server.ext.service.ArticleService;
import com.pet.server.ext.util.JsonUtil;
import com.pet.server.ext.util.NumberUtil;
import com.pet.server.ext.util.Parameters;

public class Myfocus extends ActionBase{

	public Integer article_id;
	public Page page;
	
	
	public Myfocus(){
		 needCheckAuth =true;
	}
	
	@Override
	public void initParameters(Parameters params) throws ApiError {
		article_id = NumberUtil.getInteger(params.getFieldValue("article_id"));
		page = newPage(params);
	}
	
	@Override
	public Result invokeService() throws ApiError {
		ArticleService articleService = new ArticleService();
		articleService.searchArtilceByFocus(page, user.user_id);
		JSONArray array = JsonUtil.articleArray((java.util.List<Article>)page.getList());
		Result result = new Result();
		result.setPage4array(page, array);
        //data.put("message", "添加收藏成功!");
        // result.put("data", data);
	    return result;
	}


}
